#include<iostream>
#include<stdio.h>
using namespace std;
#include <iomanip>
#include  <cmath>
int main() {
    int a, b, c;
    cin >> a >> b;
    if (a + b <= 7)
    {
        cout << a + b;
    }
    if (a + b > 7) {
        if ((a + b) % 7 != 0)
        {
            cout << (a + b) % 7;
        }
        else
            cout << "7";

    }
}



